package dashboard.classinfo;

import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.util.List;

public class UserInfo implements Serializable{
	private static final long serialVersionUID = -1373199215889399396L;
	private long userId;
    private String userName;
    private int age;
    private String emailAddress;
    private List<String> values;
    private String[] valArrs;
    public long getUserId() {
        return userId;
    }
    public void setUserId(long userId) {
        this.userId = userId;
    }
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
    
    public static void main(String[] args) throws IntrospectionException {
    	System.err.println(UserInfo.class.getSuperclass());
    	Type type = UserInfo.class.getGenericSuperclass();
    	Type type2 = GenericClass.class.getGenericSuperclass();
    	Type type3 = List.class.getGenericSuperclass();
    	System.err.println(type);
    	Field[] fields = UserInfo.class.getDeclaredFields(); //serialVersionUID也会在里面
    	for(Field f: fields){
    		System.err.println(f.getName());
    	}
    	System.err.println("=============================");
    	
    	/*
    	 * 除了bean声明的字段，还会包含”class“字段在里面
    	 * 如果某个字段的get,set方法都没有，则这个字段不会被返回。
    	 */    	
    	PropertyDescriptor[] propertyDescriptors = Introspector.getBeanInfo(UserInfo.class).getPropertyDescriptors();

		for (PropertyDescriptor one : propertyDescriptors) {
				String name = one.getName();
				System.err.println(name);
			if (!"class".equals(name)) {
			}
		}
	}


}